<div class="row wrapper white-bg page-heading" style="padding-bottom: 80px;">
  <div class="container-fluid">
    <h2>{{freightAddCtrl.freightTemplateId?"编辑运费模板":"新增运费模板"}}</h2>
  </div>
  <hr/>
  <div class="container-fluid">
    <div class="col-md-12 col-table">
      <table class="table table-bordered">
        <!--运费模板名称-->
        <tr class="col-table-tr">
          <td>运费模板名称</td>
          <td>
            <div class="col-md-offset-1 col-md-4">
              <div class="form-group">
                <input type="text" ng-model="freightAddCtrl.name" class="form-control" placeholder="请输入运费模板名称">
              </div>
            </div>
          </td>
        </tr>
        <!--计价方式-->
        <tr class="col-table-tr">
          <td>计价方式</td>
          <td>
            <div class="col-md-offset-1 col-md-4">
              <div class="form-group">
                <select class="form-control" ng-model="freightAddCtrl.valuationMethod">
                  <option value="1">按件数</option>
                  <option value="2">按重量</option>
                </select>
              </div>
            </div>
          </td>
        </tr>

        <!--计价方式-->
        <tr class="col-table-tr">
          <td>满多少元包邮</td>
          <td>
            <div class="col-md-offset-1 col-md-4">
              <div class="form-group">
                <input type="number" ng-model="freightAddCtrl.overPrice" class="form-control" placeholder="请输入满多少包邮">
              </div>
            </div>
          </td>
        </tr>


      </table>
    </div>
    <div class="col-md-12 col-table">
      <button class="btn btn-primary" ng-click="freightAddCtrl.addType()">新增</button>
      <br>
      <br>
    </div>
    <div class="col-md-12 col-table">
      <table class="table table-bordered">
        <thead>
        <tr>
          <th>选择地区</th>
          <th>首件数(重量)</th>
          <th>首费（元）</th>
          <th>续件数(重量)</th>
          <th>续费（元）</th>
          <th>操作</th>
        </tr>
        </thead>
        <tr>
          <td>默认</td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="freightAddCtrl.freightTemplateAreaList[0].commodityNum" class="form-control" placeholder="首件数(重量)">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="freightAddCtrl.freightTemplateAreaList[0].freightPrice" class="form-control" placeholder="首费（元）">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="freightAddCtrl.freightTemplateAreaList[0].everyAddNum" class="form-control" placeholder="续件数(重量)">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="freightAddCtrl.freightTemplateAreaList[0].addFreightPrice" class="form-control" placeholder="续费（元）">
            </div>
          </td>
          <td>

          </td>
        </tr>
        <tr ng-repeat="(index,item) in freightAddCtrl.freightTemplateAreaList" ng-if="index>0">
          <td>{{item.province.length?'已选择地区':'未选择地区'}}
            <span ng-click="freightAddCtrl.freightEdit(index)"
                  class="btn btn-xs btn-primary" style="margin-left:20px;">编辑</span>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="item.commodityNum" class="form-control" placeholder="首件数(重量)">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="item.freightPrice" class="form-control" placeholder="首费（元）">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="item.everyAddNum" class="form-control" placeholder="续件数(重量)">
            </div>
          </td>
          <td>
            <div class="form-group">
              <input type="text" ng-model="item.addFreightPrice" class="form-control" placeholder="续费（元）">
            </div>
          </td>
          <td>
            <button ng-click="freightAddCtrl.delete(index)" class="btn btn-xs btn-danger">删除</button>
          </td>
        </tr>
      </table>
    </div>
    <div class="col-md-12 col-table">
      <button type="submit" class="btn btn-default col-md-3 col-md-offset-2" ui-sref="home.common.freightTemplate">取消
      </button>
      <button type="submit" class="btn btn-info col-md-3 col-md-offset-1" ng-click="freightAddCtrl.submit()">提交
      </button>
    </div>
  </div>
</div>
